<?php
namespace app\common\services;


/**
*构建链接
*/
use yii\helpers\Url;
use Yii;
class UrlService
{
	
	public static function buildWebUrl($path,$params=[]){
		$domain_config=\Yii::$app->params['domain'];
		$path=Url::toRoute(array_merge([$path],$params));
		return $domain_config['web'].$path;
	}
	//构建会员端的链接
	public static function buildMUrl($path,$params=[]){
		$domain_config=\Yii::$app->params['domain'];
		$path=Url::toRoute(array_merge([$path],$params));
		return $domain_config['m'].$path;
	}
	//构建官网的链接
	public static function buildWWWUrl($path,$params=[]){
		
		$domain_config=\Yii::$app->params['domain'];
		$path=Url::toRoute(array_merge([$path],$params));
		return $domain_config['www'].$path;
	}
	//构建空的链接
	public static function buildNullUrl(){
		return "javascript::void(0)";
	}
	//构建图片链接
	public static function buildPicUrl($bucket,$image_key){
		return \Yii::$app->params['domain']['www']
		.\Yii::$app->params['upload'][$bucket].'/'.$image_key;
	}
}